package com.xinzhi.mapper;

import com.xinzhi.pojo.TransferUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

@Mapper
public interface TransferUserMapper {

    @Select("SELECT balance FROM transfer_user WHERE bank_account = #{bankAccount}")
    BigDecimal selectBalanceByBankAccount(String bankAccount);

    @Select("SELECT * FROM transfer_user WHERE username = #{userName}")
    TransferUser selectByUserName(@Param("userName") String userName);

    @Update("UPDATE transfer_user SET balance = #{balance} WHERE id = #{id}")
    void updateBalance(@Param("id") Long id, @Param("balance") BigDecimal balance);
    @Select("SELECT * FROM transfer_user WHERE bank_account = #{senderBankAccount}")
    TransferUser selectByBankAccount(String senderBankAccount);


}




